//
//  JPMClientM.swift
//
//  Created by 邱仙凯 on 2022/4/11
//  Copyright (c) . All rights reserved.
//

import Foundation
import ObjectMapper

public struct JPMClientM: Mappable {

  // MARK: Declaration for string constants to be used to decode and also serialize.
  private struct SerializationKeys {
    static let rowNum = "row_num"
    static let city = "city"
    static let orgCode = "org_code"
    static let idKey = "id_key"
    static let clientType = "client_type"
    static let orgName = "org_name"
    static let address = "address"
    static let tel = "tel"
    static let accountName = "account_name"
    static let clientDesc = "client_desc"
    static let prov = "prov"
  }

  // MARK: Properties
  public var rowNum: Int?
  public var city: String?
  public var orgCode: Int?
  public var idKey: Int?
  public var clientType: String?
  public var orgName: String?
  public var address: String?
  public var tel: String?
  public var accountName: String?
  public var clientDesc: String?
  public var prov: String?

  // MARK: ObjectMapper Initializers
  /// Map a JSON object to this class using ObjectMapper.
  ///
  /// - parameter map: A mapping from ObjectMapper.
  public init?(map: Map){

  }

  /// Map a JSON object to this class using ObjectMapper.
  ///
  /// - parameter map: A mapping from ObjectMapper.
  public mutating func mapping(map: Map) {
    rowNum <- map[SerializationKeys.rowNum]
    city <- map[SerializationKeys.city]
    orgCode <- map[SerializationKeys.orgCode]
    idKey <- map[SerializationKeys.idKey]
    clientType <- map[SerializationKeys.clientType]
    orgName <- map[SerializationKeys.orgName]
    address <- map[SerializationKeys.address]
    tel <- map[SerializationKeys.tel]
    accountName <- map[SerializationKeys.accountName]
    clientDesc <- map[SerializationKeys.clientDesc]
    prov <- map[SerializationKeys.prov]
  }

  /// Generates description of the object in the form of a NSDictionary.
  ///
  /// - returns: A Key value pair containing all valid values in the object.
  public func dictionaryRepresentation() -> [String: Any] {
    var dictionary: [String: Any] = [:]
    if let value = rowNum { dictionary[SerializationKeys.rowNum] = value }
    if let value = city { dictionary[SerializationKeys.city] = value }
    if let value = orgCode { dictionary[SerializationKeys.orgCode] = value }
    if let value = idKey { dictionary[SerializationKeys.idKey] = value }
    if let value = clientType { dictionary[SerializationKeys.clientType] = value }
    if let value = orgName { dictionary[SerializationKeys.orgName] = value }
    if let value = address { dictionary[SerializationKeys.address] = value }
    if let value = tel { dictionary[SerializationKeys.tel] = value }
    if let value = accountName { dictionary[SerializationKeys.accountName] = value }
    if let value = clientDesc { dictionary[SerializationKeys.clientDesc] = value }
    if let value = prov { dictionary[SerializationKeys.prov] = value }
    return dictionary
  }

}
